package cn.selfiot.iotman;

import cn.selfiot.iotman.core.I18N;
import cn.selfiot.iotman.core.StageManager;
import cn.selfiot.iotman.helper.ProjectPersistHelper;
import cn.selfiot.iotman.view.ResourceConstants;
import javafx.application.Application;
import javafx.stage.Stage;

/**
 * 主程序
 *
 * @author hugo
 * @since 2020/7/27
 */
public class IotManApplication extends Application {
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override
    public void init() throws Exception {
        super.init();
        ProjectPersistHelper.init();
    }
    
    @Override
    public void start(Stage primaryStage) {
        StageManager stageManager = StageManager.getInstance();
        Stage stage = new Stage();
        MainController controller = new MainController();
        controller.setStage(stage);
        stageManager.loadStage(
                stage,
                controller,
                ResourceConstants.MAIN_VIEW,
                ResourceConstants.MAIN_RES,
                I18N.get("main.title"),
                null);
        stage.show();
    }
}
